﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Web报表(B/S报表)演示　－ 打印网页表格</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script src="../CreateControl.js" type="text/javascript"></script>
	<script type="text/javascript">
CreateReport("Report");

//在网页初始加载时向报表提供数据
function window_onload() {
    //Report.LoadFromURL("../grf/1a.grf");
    Report.LoadFromURL("PrintTable.grf");
}

function FillTableToReport() {
	Report.PrepareLoadData();

	//报表记录集对象
	var Recordset = Report.DetailGrid.Recordset;

	//报表记录集的各个字段
	var fldCustomerID = Report.FieldByName("CustomerID");
	var fldCompanyName = Report.FieldByName("CompanyName");
	var fldContactName = Report.FieldByName("ContactName");
	var fldContactTitle = Report.FieldByName("ContactTitle");
	var fldPhone = Report.FieldByName("Phone");
	var fldFax = Report.FieldByName("Fax");

	//网页中的表格
	var tbCustomer = document.getElementById("tbCustomer");
	var Rows = tbCustomer.tBodies[0].rows;
	
	//将每行表格数据填入到报表记录集
	for (var i=0; i<Rows.length; i++)
	{
		Recordset.Append();
		
		//FireFox不认innerText，只认textContent,所以这里要特殊处理
		if ( Rows[i].cells[0].innerText )
		{
		    fldCustomerID.Value = Rows[i].cells[0].innerText; //innerHTML  Rows[i].cells[0].firstChild.nodeValue;
		    fldCompanyName.Value = Rows[i].cells[1].innerText;
		    fldContactName.Value = Rows[i].cells[2].innerText; //Rows[i].cells[2].innerText;
		    fldContactTitle.Value = Rows[i].cells[3].innerText;
		    fldPhone.Value = Rows[i].cells[4].innerText;
		    fldFax.Value = Rows[i].cells[5].innerText;
		}
		else
		{
		    //for firefox
		    fldCustomerID.Value = Rows[i].cells[0].textContent;
		    fldCompanyName.Value = Rows[i].cells[1].textContent;
		    fldContactName.Value = Rows[i].cells[2].textContent;
		    fldContactTitle.Value = Rows[i].cells[3].textContent;
		    fldPhone.Value = Rows[i].cells[4].textContent;
		    fldFax.Value = Rows[i].cells[5].textContent;
		}
		
		Recordset.Post();
	}
}

function btnPreview_onclick() {
	FillTableToReport();
	
    Report.PrintPreview(true);
}

function btnPrint_onclick() {
	FillTableToReport();
	
    Report.Print(true);
}

function btnExportXls_onclick() {
	FillTableToReport();

	//gretXLS = 1, 
    Report.ExportDirect(1, "", true,  true);
}
	</script>
    <style type="text/css">
        .tablecss    { font-size: 10pt }
        html,body { margin:0; height:100%; }
    </style>
</head>
<body onload="window_onload()">
	<p><input id="btnPreview" onclick="return btnPreview_onclick()" type="button" value="打印预览"
			name="btnPreview"/>&nbsp;<input id="btnPrint" onclick="return btnPrint_onclick()" type="button" value="直接打印" name="btnPrint"/> 
    <input id="btnExportXls" onclick="return btnExportXls_onclick()" type="button" value="导出为Excel" name="btnExportXls"/></p>
	<table  class="tablecss" id="tbCustomer" border="1" width="716" cellspacing="0" 
		style="background-color: #ffffff; border-bottom: black thin solid; border-left: black thin solid; border-top: black thin solid; border-right: black thin solid;">
		<thead>
		<tr style="height: 30px; background-color: #f5f5f5;">
			<th style="width: 92px">
				客户编号</th>
			<th style="width: 162px">
				公司名称</th>
			<th style="width: 76px">
				联系人</th>
			<th style="width: 101px">
				联系人称谓</th>
			<th style="width: 136px">
				电话</th>
			<th style="width: 130px">
				传真</th>
		</tr>
		</thead>
		<tbody>
		<tr style="height: 30px">
			<td style="width: 92px">
				BLONP</td>
			<td style="width: 162px">
				国皓</td>
			<td style="width: 76px">
				黄雅玲</td>
			<td style="width: 101px">
				市场经理</td>
			<td style="width: 136px">
				(0671) 88601531</td>   
			<td style="width: 130px">
				(0671) 88601532</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				CACTU</td>
			<td style="width: 162px">
				威航货运有限公司</td>
			<td style="width: 76px">
				刘先生</td>
			<td style="width: 101px">
				销售代理</td>
			<td style="width: 136px">
				(061) 11355555</td>   
			<td style="width: 130px">
				(061) 11354892</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				CENTC</td>
			<td style="width: 162px">
				三捷实业</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				市场经理</td>
			<td style="width: 136px">
				(061) 15553392</td>   
			<td style="width: 130px">
				(061) 15557293</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				HUNGC</td>
			<td style="width: 162px">
				五金机械</td>
			<td style="width: 76px">
				苏先生</td>
			<td style="width: 101px">
				销售代表</td>
			<td style="width: 136px">
				(053) 5556874</td>   
			<td style="width: 130px">
				(053) 5552376</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px; height: 30px;">
				MEREP</td>
			<td style="width: 162px; height: 30px;">
				华科</td>
			<td style="width: 76px; height: 30px;">
				吴小姐</td>
			<td style="width: 101px; height: 30px;">
				市场助理</td>
			<td style="width: 136px; height: 30px;">
				(0514) 5558054</td>   
			<td style="width: 130px; height: 30px;">
				(0514) 5558055</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				QUEDE</td>
			<td style="width: 162px">
				兰格英语</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				结算经理</td>
			<td style="width: 136px">
				(010) 65554252</td>   
			<td style="width: 130px">
				(010) 65554545</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				QUEEN</td>
			<td style="width: 162px">
				留学服务中心</td>
			<td style="width: 76px">
				赵小姐</td>
			<td style="width: 101px">
				市场助理</td>
			<td style="width: 136px">
				(010) 85551189</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				GREAL</td>
			<td style="width: 162px">
				仪和贸易</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				市场经理</td>
			<td style="width: 136px">
				(010) 65557555</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				FRANK</td>
			<td style="width: 162px">
				友恒信托</td>
			<td style="width: 76px">
				余小姐</td>
			<td style="width: 101px">
				市场经理</td>
			<td style="width: 136px">
				(089) 3877310</td>   
			<td style="width: 130px">
				(089) 3877451</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				OCEAN</td>
			<td style="width: 162px">
				利合材料</td>
			<td style="width: 76px">
				陈先生</td>
			<td style="width: 101px">
				销售代理</td>
			<td style="width: 136px">
				(0117) 1355333</td>   
			<td style="width: 130px">
				(0117) 1355535</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				VICTE</td>
			<td style="width: 162px">
				千固</td>
			<td style="width: 76px">
				苏先生</td>
			<td style="width: 101px">
				销售代理</td>
			<td style="width: 136px">
				(071) 8325486</td>   
			<td style="width: 130px">
				(071) 8325487</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				TRADH</td>
			<td style="width: 162px">
				亚太公司</td>
			<td style="width: 76px">
				陈先生</td>
			<td style="width: 101px">
				销售代表</td>
			<td style="width: 136px">
				(031) 55562167</td>   
			<td style="width: 130px">
				(031) 55562168</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				WARTH</td>
			<td style="width: 162px">
				升格企业</td>
			<td style="width: 76px">
				王俊元</td>
			<td style="width: 101px">
				结算经理</td>
			<td style="width: 136px">
				(031) 9814655</td>   
			<td style="width: 130px">
				(031) 9813655</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				NORTS</td>
			<td style="width: 162px">
				富同企业</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				销售员</td>
			<td style="width: 136px">
				(031) 5557733</td>   
			<td style="width: 130px">
				(031) 555-2530</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				PARIS</td>
			<td style="width: 162px">
				立日股份有限公司</td>
			<td style="width: 76px">
				李柏麟</td>
			<td style="width: 101px">
				物主</td>
			<td style="width: 136px">
				(031) 4234226</td>   
			<td style="width: 130px">
				(031) 4234227</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				FOLIG</td>
			<td style="width: 162px">
				嘉业</td>
			<td style="width: 76px">
				刘先生</td>
			<td style="width: 101px">
				助理销售代理</td>
			<td style="width: 136px">
				(0321) 20161016</td>   
			<td style="width: 130px">
				(0321) 20161017</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				ANTON</td>
			<td style="width: 162px">
				坦森行贸易</td>
			<td style="width: 76px">
				王炫皓</td>
			<td style="width: 101px">
				物主</td>
			<td style="width: 136px">
				(0321) 5553932</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				ALFKI</td>
			<td style="width: 162px">
				三川实业有限公司</td>
			<td style="width: 76px">
				刘小姐</td>
			<td style="width: 101px">
				销售代表</td>
			<td style="width: 136px">
				(030) 30074321</td>   
			<td style="width: 130px">
				(030) 30765452</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				ANATR</td>
			<td style="width: 162px">
				东南实业</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				物主</td>
			<td style="width: 136px">
				(030) 35554729</td>   
			<td style="width: 130px">
				(030) 35553744</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				BLAUS</td>
			<td style="width: 162px">
				森通</td>
			<td style="width: 76px">
				王先生</td>
			<td style="width: 101px">
				销售代表</td>
			<td style="width: 136px">
				(030) 30058460</td>   
			<td style="width: 130px">
				(030) 33008924</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				CHOPS</td>
			<td style="width: 162px">
				浩天旅行社</td>
			<td style="width: 76px">
				方先生</td>
			<td style="width: 101px">
				物主</td>
			<td style="width: 136px">
				(030) 30076545</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				COMMI</td>
			<td style="width: 162px">
				同恒</td>
			<td style="width: 76px">
				刘先生</td>
			<td style="width: 101px">
				销售员</td>
			<td style="width: 136px">
				(030) 35557647</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				FISSA</td>
			<td style="width: 162px">
				嘉元实业</td>
			<td style="width: 76px">
				刘小姐</td>
			<td style="width: 101px">
				结算经理</td>
			<td style="width: 136px">
				(091) 25559444</td>   
			<td style="width: 130px">
				(091) 25555593</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				EASTC</td>
			<td style="width: 162px">
				中通</td>
			<td style="width: 76px">
				林小姐</td>
			<td style="width: 101px">
				销售代理</td>
			<td style="width: 136px">
				(030) 35550297</td>   
			<td style="width: 130px">
				(030) 35553373</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				PERIC</td>
			<td style="width: 162px">
				就业广兑</td>
			<td style="width: 76px">
				唐小姐</td>
			<td style="width: 101px">
				销售代表</td>
			<td style="width: 136px">
				(030) 55223745</td>   
			<td style="width: 130px">
				(030) 55453745</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				QUICK</td>
			<td style="width: 162px">
				高上补习班</td>
			<td style="width: 76px">
				徐先生</td>
			<td style="width: 101px">
				结算经理</td>
			<td style="width: 136px">
				(030) 72035188</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				MORGK</td>
			<td style="width: 162px">
				仲堂企业</td>
			<td style="width: 76px">
				徐文彬</td>
			<td style="width: 101px">
				市场助理</td>
			<td style="width: 136px">
				(030) 34202376</td>   
			<td style="width: 130px">
				&nbsp;</td>
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				GROSR</td>
			<td style="width: 162px">
				光远商贸</td>
			<td style="width: 76px">
				陈先生</td>
			<td style="width: 101px">
				物主</td>
			<td style="width: 136px">
				(030) 32832951</td>   
			<td style="width: 130px">
				(030) 32833397</td>  
		</tr>
		<tr style="height: 30px">
			<td style="width: 92px">
				HUNGO</td>
			<td style="width: 162px">
				师大贸易</td>
			<td style="width: 76px">
				苏先生</td>
			<td style="width: 101px">
				销售员</td>
			<td style="width: 136px">
				(030) 29672542</td>   
			<td style="width: 130px">
				(030) 29673333</td>  
		</tr>
		</tbody>
	</table>
</body>
</html>
